package com.nwpu.am.mapper;

import com.nwpu.am.pojo.entity.Warehouse;
import org.apache.ibatis.annotations.*;

@Mapper
public interface WarehouseMapper {
    @Insert("INSERT INTO tb_warehouse (warehouse_id, warehouse_name, address, description, status) VALUES (#{warehouseId}, #{warehouseName}, #{address}, #{description}, #{status})")
    Warehouse insertWarehouse(Warehouse warehouse);

    @Select("SELECT * FROM tb_warehouse WHERE warehouse_id = #{warehouseId}")
    Warehouse selectWarehouseById(int warehouseId);

    int updateWarehouse(Warehouse warehouse);

    @Delete("DELETE FROM tb_warehouse WHERE warehouse_id = #{warehouseId}")
    int deleteWarehouseById(int warehouseId);

    @Select("SELECT * FROM tb_warehouse WHERE warehouse_name = #{warehouseName}")
    Warehouse selectWarehouseByName(String warehouseName);
}
